Ambulatory medical devices, such as implantable pacemakers and cardioverter-defibrillators, can chronically stimulate excitable tissues or organs, such as a heart, such as to treat abnormal cardiac rhythms such as bradycardia or tachycardia, or to help improve cardiac performance such as by correcting cardiac dyssynchrony in a patient with congestive heart failure (CHF). Such ambulatory medical devices can have one or more electrodes that can be positioned within the heart or on a surface of the heart for contacting the cardiac tissue. The electrodes can be electrically coupled to an electronics unit such as a pulse generator, such as via a lead, and can be used to deliver one or more electrostimulations to the heart, such as to restore the normal heart function.